<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
</head>
<body>
   <h1>用户列表</h1>
   <div id="list">

   </div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script>
      $.ajax({
          url:'http://localhost:8080/user2/list',
          method:'get',
          dataType:'json',
          success:function (data) {
                console.log(data);
                $.each(data,function (index,item) {
                    console.log(item);
                    var box = $('<div></div>').text(item.username);
                    $('#list').append(box)
                })
          }
      })

</script>
</html>